﻿namespace Sidvall.WorkItemManager.UI.Entities.ConfigModel
{
    public class ResourceFactory : global::Sidvall.Data.IResourceFactory
    {
        #region CreateItem

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItem(string resource, Sidvall.Data.DataRowState? dataRowState)
        {
            switch (resource)
            {
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.UserConfiguration:
                    return new global::Sidvall.WorkItemManager.UI.Entities.UserConfiguration(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.ServerConnection:
                    return new global::Sidvall.WorkItemManager.UI.Entities.ServerConnection(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.Schedule:
                    return new global::Sidvall.WorkItemManager.UI.Entities.Schedule(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.IntervalRetryPolicy:
                    return new global::Sidvall.WorkItemManager.UI.Entities.IntervalRetryPolicy(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitoredWorkItem:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitoredWorkItem(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitorContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitorContext(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WorkItemAlarm:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WorkItemAlarm(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitorExecutionContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitorExecutionContext(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.IdentityProvider:
                    return new global::Sidvall.WorkItemManager.UI.Entities.IdentityProvider(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebExecutionContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebExecutionContext(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebContext(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebTarget:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebTarget(dataRowState);
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebResult:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebResult(dataRowState);
                default:
                    return null;
            }
        }
        
        #endregion
        #region CreateItems
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public object CreateItems(string resource)
        {
            switch (resource)
            {
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.UserConfiguration:
                    return new global::Sidvall.WorkItemManager.UI.Entities.UserConfigurationCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.ServerConnection:
                    return new global::Sidvall.WorkItemManager.UI.Entities.ServerConnectionCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.Schedule:
                    return new global::Sidvall.WorkItemManager.UI.Entities.ScheduleCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.IntervalRetryPolicy:
                    return new global::Sidvall.WorkItemManager.UI.Entities.IntervalRetryPolicyCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitoredWorkItem:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitoredWorkItemCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitorContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitorContextCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WorkItemAlarm:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WorkItemAlarmCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.MonitorExecutionContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.MonitorExecutionContextCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.IdentityProvider:
                    return new global::Sidvall.WorkItemManager.UI.Entities.IdentityProviderCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebExecutionContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebExecutionContextCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebContext:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebContextCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebTarget:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebTargetCollection();
                case global::Sidvall.WorkItemManager.Data.ConfigModel.DomainObjects.WebResult:
                    return new global::Sidvall.WorkItemManager.UI.Entities.WebResultCollection();
                default:
                    return null;
            }
        }
        
        #endregion
        
        #region Current

        private static readonly System.Lazy<ResourceFactory> _Current = new System.Lazy<ResourceFactory>(() => new ResourceFactory());
        public static ResourceFactory Current
        {
            get
            {
                return _Current.Value;
            }
        }

        #endregion
    }
}